<div class="layuimini-main">
    <div class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">选择应用</label>
            <div class="layui-input-block">
            	<input type="hidden" name="id" id="id" value="">
            	<select lay-filter="appNameFilter" lay-verify="required" lay-reqtext="应用不能为空" name="appId" id="appIdse"></select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">开放平台地址</label>
            <div class="layui-input-block">
                <input type="text" name="apolloPortalUrl" id="apolloPortalUrl" lay-verify="required" lay-reqtext="开放平台地址不能为空" placeholder="请输入开放平台地址" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">环境</label>
            <div class="layui-input-block">
            	<input type="text" name="apolloEnv" id="apolloEnv" lay-verify="required" lay-reqtext="环境不能为空"  placeholder="请输入环境" value="" class="layui-input">
            	<tip>apollo.env</tip>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">集群</label>
            <div class="layui-input-block">
            	<input type="text" name="apolloCluster" id="apolloCluster" placeholder="请输入集群" value="default" class="layui-input">
            	<tip>apollo.cluster</tip>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">授权码</label>
            <div class="layui-input-block">
            	<input type="text" name="apolloToken" id="apolloToken" lay-verify="required" lay-reqtext="授权码不能为空" placeholder="请输入授权码" value="" class="layui-input">
            	<tip>apollo.token</tip>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">APPID</label>
            <div class="layui-input-block">
            	<input type="text" name="apolloAppId" id="apolloAppId" lay-verify="required" lay-reqtext="APPID不能为空" placeholder="请输入APPID" value="" class="layui-input">
            	<tip>apollo的应用id</tip>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">保存</button>
                <button class="layui-btn layui-btn-danger" id="closeTPage">取消</button>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table,
            $ = layui.$;
        form.render();
        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;
        //监听提交
        form.on('submit(saveBtn)', function (data) {
        	axios({
        		method:"post",
        		url:"app/apollo/update",
        		data:data.field
        	}).then(function(response){
        		var data = response.data
        		if(data.success){
        			 layer.close(parentIndex);
        		}else{
        			layer.msg(data.errorMsg, {icon: 2});
        		}
        	});
            return false;
        });
        $("#closeTPage").click(function () {
        	layer.close(parentIndex);
        });
    });
</script>